<template>
  <section class="oa-form__table">
    <h5>{{approve.name}}</h5>
    <table cellpadding="0" cellspacing="0">
      <tr v-if="$route.query.from != 'new'">
        <td>事务编号</td>
        <td>
          {{ approve.name }}
          <span v-if="approve && approve.code">{{ approve.code }}</span>
        </td>
      </tr>
      <tr>
        <td>流程名称</td>
        <td>
          <span v-if="$route.query.from == 'new'">
            新建{{approve.name}}
          </span>
          <span v-else>
            {{approve.approve_name}}
          </span>
        </td>
      </tr>
      <tr>
        <td>申请事由</td>
        <td :title="reason"><el-input placeholder="申请事由" type="textarea" v-model="reason" :disabled="$route.query.from != 'new'"/></td>
      </tr>
    </table>
    <h3 class="oa-form__table-title">
      <span v-if="$route.query.from === 'new'">{{ approve.name }}</span>
      <span v-else>
        {{ approve.approve_name }}
      </span>
    </h3>
    <table class="achievement__tab">
       <tr class="border_0">
        <td width="110">考核周期:</td>
        <td width="145">
          <el-date-picker
            value-format="yyyy-MM-dd"
            type="date"
            v-model="applyTime"
            :disabled="$route.query.from !== 'new'"
            placeholder="考核周期">
          </el-date-picker>
        </td>
        <td width="34">部门:</td>
        <td>
          <el-select v-model="department" :disabled="$route.query.from != 'new'" placeholder="请选择">
            <el-option
              v-for="item in departments"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </td>
        <td width="48">&nbsp;</td>
        <td width="113">&nbsp;</td>
        <td width="113">姓名:</td>
        <td width="111">
          <el-select v-model="value" style="width:60%" :disabled="$route.query.from != 'new'" placeholder="请选择"  @change="selectStaff($event)">
            <el-option
              v-for="item in staff"
              :key="item.value"
              :label="item.label"
              :value="item">
            </el-option>
          </el-select>
        </td>
        <!-- <td>岗位:</td> -->
        <td width="219">岗位:<span style="display:inline-block;width:100px;padding-left:10px;"><el-input v-model="gangwei" :disabled="$route.query.from !== 'new'" placeholder="岗位"/></span></td>
      </tr>
      <tr>
        <td class="_name">考核指标</td>
        <td class="_name">指标定义</td>
        <td class="_name">权重</td>
        <td class="_name" width="300">评分说明</td>
        <td class="_name">数据来源</td>
        <td class="_name">评分标准</td>
        <td class="_name">评定人</td>
        <td class="_name">自评</td>
        <td class="_name">实际得分</td>
        <!-- <td class="_name" width="346">事项说明</td> -->
      </tr>
      <tr>
        <td rowspan="4">摄影质量及时效</td>
        <td>创意/脚本</td>
        <td>20%</td>
        <td>
          参与策划选题，结合产品卖点及活动主题，策划视频、图片创意等，和团队一起完成拍摄任务</td>
        <td>自评</td>
        <td>积极参与策划选题，结合产品卖点及活动主题，策划视频、图片创意等，和团队一起完成拍摄任务，对创意和脚本有贡献度</td>
        <td>尉宜乔</td>
        <td><el-input v-model="obj.a956" :disabled="obj.a956Flag" /></td>
        <td><el-input v-model="obj.a961" :disabled="obj.a961Flag" /></td>
      </tr>
      <tr>
        <td>
          拍摄美观及配合时效
        </td>
        <td>25%</td>
        <td>1、拍摄的美观度；15<br />
        2、返工率（重拍）考核；10</td>
        <td>自评</td>
        <td>1、拍摄的美观需获得达人/剪辑认可；<br />
        2、保证完成每天预计拍摄条数，单个素材反复拍摄超过6次扣1分</td>
        <td>黄珺怡/郑素美</td>
        <td><el-input v-model="obj.a957" :disabled="obj.a957Flag" /></td>
        <td><el-input v-model="obj.a962" :disabled="obj.a962Flag" /></td>
      </tr>
      <tr>
        <td>拍摄质量</td>
        <td>40%</td>
        <td>1、灯光布置效果； 5<br />
          2、构图及拍摄角度； 10<br />
          3、拍摄素材效率； 5<br />
          4、镜头语言及运镜； 15<br />
        5、单月剪辑数量； 5</td>
        <td>自评</td>
        <td><br />
          1、单个类型素材返工一次扣1分；<br />
          2、镜头语言及运镜需获得林总认可；<br />
          3、构图及拍摄角度需获得编导/剪辑认可，被指问题一次扣1分；<br />
          4、拍摄灯光过暗、过爆、噪点等影响视频质量，被指问题一次扣1分<br />
          5、单月剪辑数量达到上级要求，没有配合扣1分</td>
        <td>林总</td>
        <td><el-input v-model="obj.a958" :disabled="obj.a958Flag" /></td>
        <td><el-input v-model="obj.a963" :disabled="obj.a963Flag" /></td>
      </tr>
      <tr>
        <td>工作态度</td>
        <td>10%</td>
        <td>
          积极配合编导和剪辑的需求，完善视频创意及脚本输出</td>
        <td>自评</td>
        <td>1、积极配合编导和剪辑的需求，端正且积极的工作态度；<br />
        2、主动对视频质量提出创意和提升拍摄变现能力，完善视频创意及脚本输出。</td>
        <td>林总</td>
        <td><el-input v-model="obj.a959" :disabled="obj.a959Flag" /></td>
        <td><el-input v-model="obj.a964" :disabled="obj.a964Flag" /></td>
      </tr>
      <tr>
        <td>公司制度执行</td>
        <td>遵守公司规章制度</td>
        <td>5%</td>
        <td>
          遵守公司规章制度及执行力、配合度</td>
        <td>自评</td>
        <td>对公司制度及公司文化的理解和执行（包括根据公司整体规划制定个人工作计划，合理安排个人各项工作时间，遵守公司各项制度、积极配合领导安排的工作事宜等）</td>
        <td>督导</td>
        <td><el-input v-model="obj.a960" :disabled="obj.a960Flag" /></td>
        <td><el-input v-model="obj.a965" :disabled="obj.a965Flag" /></td>
      </tr>
      <tr>
        <td colspan="3">自评:{{myScore}}</td>
        <td colspan="7">综合考核率:{{otherScore}}</td>
      </tr>
    </table>
    <history :process="process"></history>
    <files></files>
  </section>
</template>
<script>
import mixin from '@/mixins/index.js'
import history from '../service/components/process'
import files from '../service/components/files'
import { sum } from '@/utils/domUtils.js'
const obj = {}
for (let i = 955; i <= 965; i++) {
  obj[`a${i}`] = ''
  obj[`a${i}Flag`] = true
}
export default {
  mixins: [mixin],
  data () {
    return {
      reason: '',
      truename: '',
      department: '',
      flag: false,
      value: '',
      obj: JSON.parse(JSON.stringify(obj)),
      applyTime: '',
      gangwei: '',
      file_paths: [],
      file_names: [],
      field_ids: [],
      field_vals: [],
      autoField: []
    }
  },
  components: { history, files },
  props: ['curDepartment', 'userInfo', 'approve', 'staff', 'addDofield', 'departments', 'process'],
  computed: {
    uploadArr () {
      return this.$store.state.uploadArr
    },
    myScore () {
      const result = []
      for (let i = 956; i <= 960; i++) {
        if (this.obj[`a${i}`]) {
          result.push(this.obj[`a${i}`])
        }
      }
      return sum(result)
    },
    otherScore () {
      const result = []
      for (let i = 961; i <= 965; i++) {
        if (this.obj[`a${i}`]) {
          result.push(this.obj[`a${i}`])
        }
      }
      return sum(result)
    }
  },
  mounted () {
    this.$nextTick(() => {
      this.obj = JSON.parse(JSON.stringify(obj))
      if (this.$route.query.from === 'new') {
        this.disabled = true
      } else {
        this.infoFunc()
      }
    })
  },
  methods: {
  }
}
</script>
